<?php
add_action('init', 'myStartSession', 1);
function myStartSession() {
   if (!session_id()) {
      session_start();
   }
}

/* * ***************************************************************
  Ngừng bão dưỡng website
 * *************************************************************** */

function afublog_che_do_bao_tri() {
   global $current_user;
   get_currentuserinfo();
   if (!current_user_can('level_2') && $current_user->user_email != 'info@quancafenhatrang.com') {
//        wp_die('Trang web tạm thời đang được bảo trì. Xin vui lòng quay trở lại sau.');
      wp_die('Building..');
   }
}
//add_action('wp_head', 'afublog_che_do_bao_tri');
// Add RSS links to <head> section
automatic_feed_links();

// Load jQuery
if (!is_admin()) {
   wp_deregister_script('jquery');
   wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"), false);
   wp_enqueue_script('jquery');
}

// Clean up the <head>
function removeHeadLinks() {
   remove_action('wp_head', 'rsd_link');
   remove_action('wp_head', 'wlwmanifest_link');
}

add_action('init', 'removeHeadLinks');
remove_action('wp_head', 'wp_generator');

// Declare sidebar widget zone
if (function_exists('register_sidebar')) {
   register_sidebar(array(
       'name' => 'Sidebar Widgets',
       'id' => 'sidebar-widgets',
       'description' => 'These are widgets for the sidebar.',
       'before_widget' => '<div id="%1$s" class="widget %2$s">',
       'after_widget' => '</div>',
       'before_title' => '<h2>',
       'after_title' => '</h2>'
   ));
}

/* post-thumbnails */
add_theme_support('post-thumbnails');

/* * ***************************************************************
  Add menus
 * *************************************************************** */

function register_my_menus() {
   register_nav_menus(
           array('main-menu' => __('Main Menu'),
               'danh-muc-san-pham' => __('Danh mục sản phẩm'),
               'footer-menu' => __('Footer Menu')
               )
   );
}

add_action('init', 'register_my_menus');

/* * ***************************************************************
  Set css cho phần admin
 * *************************************************************** */

function cf_setup() {
   // This theme styles the visual editor with editor-style.css to match the theme style.
   add_editor_style();
}

add_action('after_setup_theme', 'cf_setup');
?>